package com.example.springbootstudy.Mapper;

import com.example.springbootstudy.pojo.Dept;
import com.example.springbootstudy.pojo.Manager;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper//标记该接口为MyBatis的Mapper接口,用于实现数据库操作，Spring会自动将该接口注册为Bean
public interface DeptMapper {
    @Select("select * from dept")
    public List<Dept> selectAllMapper();

    @Delete("delete from dept where id =#{id}")//MyBatis 的@Delete注解
    public void delOneDao(Integer id);

    @Insert("insert into dept values(null,#{name},#{createTime},#{updateTime})")
    public void insertMapper(Dept dept);

    @Select("select * from dept where id=#{id}")
    public Dept getOneMapper(Integer id);

    @Update("update dept set name=#{name},update_time=#{updateTime} where id=#{id}")
    public void updateMapper(Dept dept);

    @Select("select * from manager where admin=#{admin} and password=#{password}")
    public Manager adminMapper(Manager manager);
}
